/**
 * Copyright(C) 2008 Matthias Braunhofer
 * All rights reserved
 *
 * Created on: 12.07.2008
*/

package it.cums.model;

import java.beans.PropertyChangeListener;
import java.util.ArrayList;

public class OrderedProduct {
	private ArrayList<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
	private int id;
	private String product;
	private double price;
	private int quantity;
	private double totalPrice;
	private int discount;
	private double endPrice;
	private Order order;
	
	public OrderedProduct() {
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getProduct() {
		return product;
	}

	public void setProduct(String product) {
		this.product = product;
		notifyListeners();
	}

	public void setPrice(double price) {
		this.price = price;
		notifyListeners();
	}

	public double getPrice() {
		return price;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
		notifyListeners();
	}

	public double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
		notifyListeners();
	}

	public int getDiscount() {
		return discount;
	}

	public void setDiscount(int discount) {
		this.discount = discount;
		notifyListeners();
	}
	
	public double getEndPrice() {
		return endPrice;
	}
	
	public void setEndPrice(double endPrice) {
		this.endPrice = endPrice;
		notifyListeners();
	}
	
	public void setOrder(Order order) {
		this.order = order;
	}
	
	public Order getOrder() {
		return order;
	}
	
	private void notifyListeners() {
		for (PropertyChangeListener listener : listeners) {
			listener.propertyChange(null);
		}
	}
	
	public void setPropertyChangeListeners(ArrayList<PropertyChangeListener> listeners) {
		this.listeners = listeners;
	}
}
